package com.albert.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/*
* 创建线程池的两种方式1.Executors.newFixedThreadPool(10)
* 2.new ThreadPoolExecutor()
* */
public class ThreadPool {
    //1.线程池
    public static ExecutorService service = Executors.newFixedThreadPool(10);

    public static void main(String[] args) {
        System.out.println("开始");
        service.execute(new Thread01());
        System.out.println("结束");
        //第二种 new ThreadPoolExecutor(多个参数)

    }

    public static class Thread01 extends Thread{
        @Override
        public void run() {
            System.out.println("执行线程池的任务");
        }
    }
}
